package com.hznu.management.controller;

import com.alibaba.fastjson.JSON;
import com.hznu.management.annotation.SystemLog;
import com.hznu.management.enums.LogType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/system/log")
public class SystemLogController {

    @PostMapping("/test1")
    @SystemLog(description = "测试日志1", type = LogType.ADD)
    public String SystemLogTest1(@RequestBody String params) {
        log.info("日志测试，入参：{}", params);
        return "success";
    }

    @PostMapping("/test2")
    @SystemLog(description = "测试日志2", type = LogType.ADD)
    public String SystemLogTest2(@RequestParam("params") String params) {
        log.info("日志测试，入参：{}", params);
        return "success";
    }

    @PostMapping("/test3")
    @SystemLog(description = "测试日志2", type = LogType.ADD)
    public String SystemLogTest3(@RequestParam("params") String params, @RequestBody String device) {
        log.info("日志测试，入参：{},{}", params, JSON.toJSONString(device));
        return "success";
    }
}
